package br.com.bestOffer.converters;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.bestOffer.enumerator.VersaoMemoriaRam;

@FacesConverter(value="VersaoMemoriaRamConverter")
public class VersaoMemoriaRamConverter implements Converter {

	public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {

		if(value != null && value.trim().length() > 0){
			return Enum.valueOf(VersaoMemoriaRam.class, value);
		}else{
			return null;
		}
	}

	public String getAsString(FacesContext arg0, UIComponent arg1, Object value) {
		if(value != null){
			return value.toString();
		}else{
			return null;
		}
	}
	}
